import { Module } from '@nestjs/common';
import { SequelizeModule } from '@nestjs/sequelize';
import { AccountService } from './service/account.service';
import { AccountController } from './controller/account.controller';
import { JwtModule } from '@nestjs/jwt';
import { jwtConstants } from '../auth/constants';
import { RpAccount } from './entity/account.entity';
import { AccountProviders } from './provider/account.providers';
import { DatabaseModule } from '../../database/database.module';
import { AuthService } from '../auth/service/auth.service';
import { LoginLogService } from '../login-log/service/login-log.service';
import { LoginLogProviders } from '../login-log/provider/loginLog.providers';
import { LoginLogEntity } from '../login-log/entity/loginLog.entity';
@Module({
  controllers: [AccountController],
  imports: [
    DatabaseModule,
    JwtModule.register({
      secret: jwtConstants.secret,
      signOptions: { expiresIn: jwtConstants.expiresSecond }, // token 过期时效
    }),
    SequelizeModule.forFeature([RpAccount, LoginLogEntity]),
  ],
  providers: [
    AccountService,
    AuthService,
    LoginLogService,
    ...AccountProviders,
    ...LoginLogProviders,
  ],
  exports: [AccountService],
})
export class AccountModule {}
